package design_patterns;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class Main implements InvocationHandler {
    private Object target;

    public void setTarget(Object target) {
        this.target = target;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

        before();
        Object feedback=method.invoke(target,args);
        after();
        return "eee"+feedback;
    }
    public void before(){
        System.out.println("eeeee");
    }
    public void after(){
        System.out.println("吃饭吃饭");
    }
}
